﻿@{
    ViewBag.Title = "Index";
}

<h2>Applications</h2>
<ul class="nav nav-pills">
    <li>@Html.ActionLink("New Application", "Manage")</li>
</ul>
<table class="table table-striped hide table-condensed" data-bind="css:{hide:!applications().length}">
    <thead>
        <tr>
            <th></th>
            <th>Enabled</th>
            <th>Namespace</th>
            <th>Name</th>
        </tr>
    </thead>
    <tbody data-bind="foreach:applications">
        <tr>
            <td>
                @{ var url = @Url.Action("Manage"); }
                <a class="btn btn-primary" data-bind="attr: { href: '@url#' + $data.id() }">Manage</a>
                
                <div class="btn-group">
                    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Delete
                        <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="#" data-bind="click: function (data, evt) { $parent.deleteApp(data) }"><span class="icon-ok"></span>
                                Confirm</a>
                        </li>
                        <li>                            
                            <a href="#"><span class="icon-remove"></span>
                                Cancel</a>
                        </li>
                    </ul>
                </div>
            </td>
            <td data-bind="text: email"></td>
            <td data-bind="text: created"></td>
            <td data-bind="text: lastUpdated"></td>
        </tr>
    </tbody>
</table>
<p data-bind="css:{hide:applications().length}" class="hide alert alert-warning">
    No Applications Found
</p>

@section scripts{
    <script src="~/Areas/Admin/Scripts/UserAccount.js"></script>
}